# Maintainer: Frederik Schwan <freswa at archlinux dot org>
# Contributor: Mattias Andrée <`base64 -d`(bWFhbmRyZWUK)@kth.se>

pkgname=libkeccak
pkgver=1.3.1.2
pkgrel=1
pkgdesc='Keccak-family hashing library'
arch=('loong64' 'x86_64')
url='https://github.com/maandree/libkeccak'
license=('custom:ISC')
depends=('glibc')
checkdepends=('valgrind')
source=("https://github.com/maandree/libkeccak/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz")
b2sums=('073f31ce45ed292caa9f06190a4045c4c23938df1643c70f9a6530a340027797a96332722723a40d6424bb910283020213ef2f54a7f469809d0d8c646e2db48e')

prepare() {
  cd ${pkgname}-${pkgver}
  sed -i 's#FLAGS\s\+=#FLAGS +=#g' optimised.mk
}

build() {
  cd ${pkgname}-${pkgver}
  make CONFIGFILE=optimised.mk PREFIX=/usr
}

check() {
  cd ${pkgname}-${pkgver}
  make CONFIGFILE=optimised.mk check
}

package() {
  cd ${pkgname}-${pkgver}
  make CONFIGFILE=optimised.mk PREFIX=/usr DESTDIR="${pkgdir}" install
}
